<?php
class BMSC_Page extends BMSC_Db
{
	public function editPage($pageID, $languageID, $content, $updateBy)
	{
		try
		{
			$pageContentInfo = array();
			$pageContentInfo["CONTENT"] = $content;
			$pageContentInfo["UPDATE_BY"] = $updateBy;
			$pageContentInfo["UPDATE_DATE"] = date("Y-m-d H:i:s");
			return $this->_writerDb->update("page_content", $pageContentInfo, "ID=" . $pageID . " AND LANGUAGE_ID='" . $languageID . "'");
		}
		catch (Exception $ex)
		{
			throw $ex;
		}
	}
	
	public function getPageList($memberID)
	{
		try
		{
			$query = sprintf("CALL sp_member_get_page_list(%u)", $memberID);
			$pages = $this->_readerDb->fetchAll($query);
			$this->_readerDb->closeConnection();
			return $pages;
		}
		catch (Exception $ex)
		{
			throw $ex;
		}		
	}

	public function getPage($pageID, $languageID = "vi")
	{
		try
		{
			$query = sprintf("CALL sp_admin_get_page(%u, '%s')", $pageID, $languageID);
			$page = $this->_readerDb->fetchRow($query);
			$this->_readerDb->closeConnection();
			return $page;
		}
		catch (Exception $ex)
		{
			throw $ex;
		}
	}
}
?>